package xhwl.hmo.mall.http.api;

import com.google.gson.Gson;

import okhttp3.RequestBody;
import rx.Observable;
import xhwl.hmo.mall.Constant;
import xhwl.hmo.mall.http.ApiService;
import xhwl.retrofitrx.BaseApi;

/**
 * Created by admin on 2017/6/6.
 */

public class RegJPushApi extends BaseApi {

    RegJPushReq req;

    public RegJPushApi(String member_id, String jg_id, String app_key) {
        req = new RegJPushReq(member_id, jg_id, app_key);
    }

    @Override
    protected Observable getObservable() {
        RequestBody requestBody = RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(req));
        return retrofit.create(ApiService.class).regJPush(requestBody);
    }

    public class RegJPushReq {
        public String app_key;
        public String jg_id;
        public String user_id;//用户ID YC_MEMBER或YC_EXPERT的ID
        public String user_type;// 用户类型(0会员 1医生)
        public String client_id;//升级client_type 例：安卓远程hmo 800


        public RegJPushReq(String member_id, String jg_id, String app_key) {
            this.user_id = member_id;
            this.jg_id = jg_id;
            this.app_key = app_key;
            this.user_type = 0 + "";
            this.client_id= Constant.CLIENT_TYPE;
        }
    }
}
